package com.mango9x.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHelper extends SQLiteOpenHelper {

	private static final String DB_NAME = "MANGO_DB.db";
	private static final int VERSION = 1;

	public static final String FAVORITES_TABLE = "favorites_table";
	public static final String CL_FILE_ID = "file_id";
	public static final String CL_TIME = "time";

	public DBHelper(Context context) {
		super(context, DB_NAME, null, VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {

		String CALL_LOG_TABLE_DDL = "CREATE TABLE IF NOT EXISTS "
				+ FAVORITES_TABLE + " (" + CL_FILE_ID
				+ " INTEGER PRIMARY KEY ," + CL_TIME + " INTEGER  NOT NULL" + ");";
		db.execSQL(CALL_LOG_TABLE_DDL);

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + FAVORITES_TABLE + " ;");
		onCreate(db);
	}
}
